package nuc.jyg.servlet;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

/**
 * @Author Nuc YongGuang Ji
 * Created by JiYongGuang on 2017/5/18.
 */

/*
* 如果不想让用户访问到资源文件可以将该servlet打开。
* 因为mvc配置文件中配置了    <mvc:default-servlet-handler /> 的原因，用户对资源文件的请求会经过该 servlet 真正访问过去。、
*
* */
//@WebServlet(name = "InsteadServlet",urlPatterns = {"*.png","*.js","*.css"})
public class InsteadServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        this.doGet(request, response);
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        PrintWriter pw = response.getWriter();

        pw.println("sorry!");
        pw.println("what are you request source not exist!");
    }
}
